{extend name="../../admin/view/main"}

{block name="button"}
<!--{if auth("clean")}-->
<button data-queue='{:url("clean")}' class='layui-btn layui-btn-sm layui-btn-primary'>定时清理订单</button>
<!--{/if}-->
{/block}

{block name="content"}
<div class="layui-tab layui-tab-card table-block">
    <ul class="layui-tab-title notselect">
        {foreach ['ta'=>'全部订单','t2'=>'待支付的订单','t3'=>'待发货的订单','t4'=>'待收货的订单','t5'=>'已完成的订单','t0'=>'已取消的订单'] as $k=>$v}
        {if isset($type) and 't'.$type eq $k}
        <li data-open="{:url('index')}?type={$k}" class="layui-this">{$v}<sup class="layui-badge border-radius">{$total[$k]??0}</sup></li>
        {else}
        <li data-open="{:url('index')}?type={$k}">{$v}<sup class="layui-badge border-radius">{$total[$k]??0}</sup></li>
        {/if}{/foreach}
    </ul>
    <div class="layui-tab-content table-block">
        {include file='shop_order/index_search'}
        <table class="layui-table margin-top-10" lay-skin="line">
            {notempty name='list'}
            <thead>
            <tr>
                <th class='list-table-check-td think-checkbox'>
                    <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
                </th>
                <th>用户信息</th>
                <th>订单信息</th>
                <th>发货信息</th>
                <th>商品信息</th>
            </tr>
            </thead>
            {/notempty}
            <tbody>
            {foreach $list as $key=>$vo}
            <tr>
                <td class='list-table-check-td think-checkbox'>
                    <label><input class="list-check-box" value='{$vo.id}' type='checkbox'></label>
                </td>
                <td class="nowrap relative">
                    <div>
                        <div class="headimg" data-tips-image data-lazy-src="{$vo.fromer.headimg|default='__ROOT__/static/theme/img/headimg.png'}"></div>
                        <div class="inline-block sub-span-blue">
                            推荐用户：{$vo.fromer.nickname|default='--'}<br>
                            推荐手机：<span>{$vo.fromer.phone|default='--'}</span><br>
                        </div>
                    </div>
                    <div>
                        <div class="headimg" data-tips-image data-lazy-src="{$vo.user.headimg|default='__ROOT__/static/theme/img/headimg.png'}"></div>
                        <div class="inline-block sub-span-blue">
                            用户昵称：{$vo.user.nickname|default='--'}<br>
                            用户手机：<span>{$vo.user.phone|default='--'}</span><br>
                        </div>
                    </div>
                </td>
                <td class='nowrap'>
                    {eq name='vo.status' value='0'}<span class="layui-badge layui-badge-middle layui-bg-gray" data-tips-text="{$vo.cancel_remark}">已取消</span>{/eq}
                    {eq name='vo.status' value='1'}<span class="layui-badge layui-badge-middle layui-bg-red">预订单</span>{/eq}
                    {eq name='vo.status' value='2'}<span class="layui-badge layui-badge-middle layui-bg-orange">待付款</span>{/eq}
                    {eq name='vo.status' value='3'}<span class="layui-badge layui-badge-middle layui-bg-black">待发货</span>{/eq}
                    {eq name='vo.status' value='4'}<span class="layui-badge layui-badge-middle layui-bg-green">已发货</span>{/eq}
                    {eq name='vo.status' value='5'}<span class="layui-badge layui-badge-middle layui-bg-blue">已完成</span>{/eq}
                    <div class="inline-block text-middle">
                        订单单号：<span class="color-blue">{$vo.order_no|default=''}</span><br>
                        订单总计 <b class="color-blue">{$vo.amount_total+0}</b> 元<span class="color-blue">{if $vo.amount_express>0}（含邮费{$vo.amount_express+0}元）{else}（包邮）{/if}</span>已支付 <b class="color-blue">{$vo.payment_amount+0}</b> 元<br>
                        下单时间：{$vo.create_at|format_datetime}<br>
                        <!--{notempty name='vo.payment_status'}-->
                        支付时间：{$vo.payment_datetime|format_datetime} {notempty name='vo.payment_name'}<span class="color-blue"> ({$vo.payment_name|default='-'})</span>{/notempty}<br>
                        <!--{else}-->
                        支付状态：<span class="color-desc">还未支付</span>
                        <!--{/notempty}-->
                    </div>
                </td>
                <td class="nowrap">
                    <div>收货信息：{$vo.truck.address_name|default='--'}<span class="margin-left-5 color-blue">{$vo.truck.address_phone|default=''}</span></div>
                    <div>收货地址：{$vo.truck.address_province|default='--'}{$vo.truck.address_city|default=''}{$vo.truck.address_area|default=''}{$vo.truck.address_content|default=''}</div>
                    <div>发货状态：<!--{if empty($vo.truck.send_number)}--><span class="layui-badge layui-bg-black">未发货</span><!--{else}--><span class="layui-badge layui-bg-blue">{$vo.truck.company_name|default='--'}</span>
                        <a data-title="快递查询" data-modal="{:url('truckQuery')}?code={$vo.truck.company_code|default=''}&number={$vo.truck.send_number|default=''}" class="layui-badge layui-bg-orange">{$vo.truck.send_number|default='--'}</a>
                        <!--{/if}-->

                        <!--{if auth('truck') and $vo.status eq 3}-->
                        <a class="margin-left-5" data-title="填写订单信息" data-modal="{:url('truck')}?order_no={$vo.order_no}">填写发货</a>
                        <!--{elseif auth('truck') and $vo.status eq 4}-->
                        <a class="margin-left-5" data-title="修改发货信息" data-modal="{:url('truck')}?order_no={$vo.order_no}">修改发货</a>
                        <!--{/if}-->

                        <!--{if auth('cancel') and in_array($vo.status, [1,2])}-->
                        <a class="margin-left-5" data-confirm="确认要取消订单吗？" data-load="{:url('cancel')}?order_no={$vo.order_no}">取消订单</a>
                        <!--{/if}-->
                    </div>
                    <div>发货时间：{$vo.truck.send_datetime|default='--'}</div>
                </td>
                <td class="nowrap">
                    {foreach $vo.items as $item}
                    <div>
                        <b class="color-blue">{$item.stock_sales|default=0}件</b><b class="color-green"> x </b><b class="color-blue">{$item.price_market+0}元 </b>
                        {$item.goods_name|default=''} <span class="color-green"> ( {$item.goods_spec|show_goods_spec} ) </span>
                    </div>
                    {/foreach}
                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
        {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
    </div>
</div>
{/block}
